package com.example.controller;

import ch.qos.logback.classic.spi.EventArgUtil;
import com.example.pojo.ClazzQueryParam;
import com.example.pojo.DO.ClazzDO;
import com.example.pojo.PageResult;
import com.example.pojo.Result;
import com.example.pojo.VO.ClazzVO;
import com.example.service.ClazzService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.security.PublicKey;
import java.time.LocalDate;

@Slf4j
@RestController
@RequestMapping("/clazzs")
public class ClazzController {
    @Autowired
    private ClazzService clazzService;

    // 修正：删除参数前的隐含绑定要求，让 Spring 自动按属性名映射
    @GetMapping
    public Result page(ClazzQueryParam clazzQueryParam) {  // 无需额外注解，直接接收对象
        log.info("分页查询 {}", clazzQueryParam);
        PageResult<ClazzVO> pageResult = clazzService.page(clazzQueryParam);
        return Result.success(pageResult);
    }
}
